package com.zmn.plat.common.dictionary;

/**
 * 渠道结算周期
 *
 * @author xiangjunming
 * @since 2019 /08/20 14:56:30
 */
@Deprecated
public enum ChannelSettleCycleEnum {

    /**
     * values
     */
    YEAR(1, "年结"),
    QUARTER(2, "季结"),
    MONTH(3, "月结"),
    WEEK(4, "周结"),
    ;

    /**
     * 年结
     */
    public static final int CONSTS_YEAR = 1;
    /**
     * 季结
     */
    public static final int CONSTS_QUARTER = 2;
    /**
     * 月结
     */
    public static final int CONSTS_MONTH = 3;
    /**
     * 周结
     */
    public static final int CONSTS_WEEK = 4;

    private Integer code;
    private String name;

    ChannelSettleCycleEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ChannelSettleCycleEnum of(Integer code) {
        if(code == null){
            return null;
        }
        switch (code) {
            case 1:
                return YEAR;
            case 2:
                return QUARTER;
            case 3:
                return MONTH;
            case 4:
                return WEEK;
            default:
                return null;
        }
    }

    public static String getName(Integer code) {
        ChannelSettleCycleEnum of = of(code);
        return of == null ? null : of.getName();
    }
}
